﻿using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.Effects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;

namespace 纸片人.win2dEffectControl.DataClass
{
    public class DisplacementMapEffectData : EffectTwoSourceData
    {

        #region 属性
        private float _amount;

        private EffectChannelSelect _xchannelSelect= EffectChannelSelect.Alpha;
        private EffectChannelSelect _ychannelSelect= EffectChannelSelect.Alpha;
        public float Amount { get => _amount; set { _amount = value; OnPropertyChanged();SetIsChanges(); } }

        public EffectChannelSelect XchannelSelect { get => _xchannelSelect; set { _xchannelSelect = value; OnPropertyChanged();SetIsChanges(); } }

        public EffectChannelSelect YchannelSelect { get => _ychannelSelect; set { _ychannelSelect = value; OnPropertyChanged(); SetIsChanges(); } }

        #endregion


        public override ICanvasImage GetEffect(CanvasDevice device, bool compression)
        {
      
            var source = GetSourceEffect(device, compression);
            if (source == null)
            {
                return null;
            }

            var twoSource = GetSourceTwoEffect(device, compression);

            DisplacementMapEffect effect = new DisplacementMapEffect()
            {
                Amount = Amount,
                 XChannelSelect = XchannelSelect,
                  YChannelSelect = YchannelSelect,
                Source = source,
                Displacement = twoSource
            };

            float y = Amount;
            float x = Amount;

            return effect;
        }
    }
}
